//
//  ARTWatchHistorySleepDisView.m
//  ChartsDemo
//
//  Created by yunda on 2021/10/15.
//

#import "ARTWatchHistorySleepDis2View.h"
#import "ARTWatchHistoryAlertView.h"

@implementation ARTWatchHistorySleepDis2View

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-  (instancetype)init{
    self = [super init];
    if (!self) {
        return nil;
    }
    // init code
    NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"ARTWatchHistorySleepDis2View" owner:nil options:nil];
    // 加载nib
    self = [arrayOfViews objectAtIndex:0];
    self.backgroundColor = [UIColor whiteColor];
    self.frame = J_Frame(15, 0, J_SCREEN_WIDTH-15*2, 180);
    
    J_ViewRadius(self, 10);
    
    [_helpImageVIew whenTapped:^{
        NSString *title = FYLocalizedString(@"sleep_watch_knowledge_title3", @"");;
        NSMutableAttributedString *contentAttribute = [[NSMutableAttributedString alloc]initWithString:FYLocalizedString(@"sleep_watch_knowledge3", @"") attributes:@{NSForegroundColorAttributeName:J_ColorFromHEX(0x222222),NSFontAttributeName:J_Font(16)}];
        [contentAttribute appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n\n" attributes:nil]];
        [contentAttribute appendAttributedString:[[NSAttributedString alloc] initWithString:FYLocalizedString(@"sleep_watch_knowledge_ox8", @"") attributes:@{NSForegroundColorAttributeName:J_ColorFromHEX(0x999999),NSFontAttributeName:J_Font(13)}]];
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
        paragraphStyle.lineSpacing = 6;
        [contentAttribute addAttributes:@{NSParagraphStyleAttributeName:paragraphStyle} range:contentAttribute.rangeOfAll];
        ARTWatchHistoryAlertView *view = [[ARTWatchHistoryAlertView alloc]initWithTitle:title messageAttribute:contentAttribute];
        [view show];
    }];
    return self;
}

@end
